import java.lang.*;
import java.util.*;
import java.util.Scanner;

public class doudizhu11 {
        public void fapai(int a) {
                int i=0;
		int i2=0;
		int i3=0;
	       	int wanjia[];
		int diannao1[];
		int diannao2[];
                int jishu[];
                  //计数，每种牌不得超过4张
                wanjia = new int[a];
		JQK jqk = new JQK();
		jishu = new int[16];
		System.out.print("你的牌：");
                while(i<a){//发牌阶段
                wanjia[i] = (int)(Math.random()*(13)+3);
                int js = wanjia[i];
	  	jishu[js]++;//计数不得超过4张
		if(js<=15)
			if(jishu[js]>4) continue;
		if(js>15)
			if(jishu[js]>1) continue;

                i++;
                }
                Arrays.sort(wanjia);//对牌进行排序
                for(i=(a-1);i>=0;i--) {
                int d = wanjia[i];
                jqk.jqk(d);
	       	}
                System.out.print("\n"); //给玩家发牌
		diannao1 = new int[17];
		System.out.print("农民1：");
		while(i2<17){//发牌阶段
                diannao1[i2] = (int)(Math.random()*(13)+3);
                 int js2 = diannao1[i2];
                jishu[js2]++;//计数不得超过4张
                if(js2<=15)
                        if(jishu[js2]>4) continue;
                if(js2>15)
                        if(jishu[js2]>1) continue;
                i2++;
                }
		Arrays.sort(diannao1);//对牌进行排序
                for(i=16;i>=0;i--) {
                int d = diannao1[i];
               jqk.jqk(d);
	       	}
		System.out.print("\n"); //给电脑1发牌
		int c=37-a;
		diannao2 = new int[c];
		if(c==17) System.out.print("农民2：");
		else if(c==20) System.out.print("地主：");
                while(i3<c){//发牌阶段
                diannao2[i3] = (int)(Math.random()*(13)+3);
                 int js3 = diannao2[i3];
                jishu[js3]++;//计数不得超过4张
                if(js3<=15)
                        if(jishu[js3]>4) continue;
                if(js3>15)
                        if(jishu[js3]>1) continue;
                i3++;
                }

                Arrays.sort(diannao2);//对牌进行排序
                for(i=(c-1);i>=0;i--) {
                int d = diannao2[i];
                jqk.jqk(d);
	       	}
                System.out.print("\n"); //给电脑2发牌
		doudizhu22 cp = new doudizhu22();
		cp.chupai();//出牌
		Scanner reader = new Scanner(System.in);
                int m = reader.nextInt();
	}
}
